package org.example.task;

import org.apache.dubbo.config.annotation.DubboReference;
import org.example.service.SpeakService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 远程服务调用测试
 */
@Component
public class TestTask implements CommandLineRunner {

    /**
     * speak远程服务
     */
    @DubboReference
    private SpeakService speakService;

    @Override
    public void run(String... args) throws Exception {
//        new Thread(() -> {
//            while(true) {
//                try {
//                    Thread.sleep(1000 * 10);
//                    System.out.println(speakService.speak("正在执行业务逻辑"));
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                    Thread.currentThread().interrupt();
//                }
//            }
//        }).start();
    }

}
